#include "utils.h" // Or your specific relative path: #include "../../include/utils.h"
#include <sys/stat.h>
#include <stdio.h> // For perror, optional for production, can be removed if not debugging

/**
 * @brief Gets the size of a file.
 *
 * @param filepath Path to the file.
 * @return uint64_t File size in bytes, or (uint64_t)-1 on error (e.g., file not found).
 */
uint64_t get_file_size(const char *filepath)
{
    if (!filepath)
    {
        return (uint64_t)-1;
    }
    struct stat st;
    if (stat(filepath, &st) == 0)
    {
        return st.st_size;
    }
    // perror("get_file_size (stat)"); // Optional: for debugging, prints error to stderr
    return (uint64_t)-1;
}

// Implement other utility functions declared in utils.h here.
// For example:
/*
void secure_clear_key(void *key, size_t len) {
    if (key) {
        volatile unsigned char *p = key;
        while (len--) {
            *p++ = 0;
        }
    }
}
*/